package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * 说明:
 *
 * @author:SuZhongHe
 * @date:2023/3/2
 **/
public class CollectionOperDemo {
    public static void main(String[] args) {
        Collection c1=new ArrayList();
        Collection c2=new ArrayList();
        c1.add("java");
        c1.add("python");
        c1.add("c++");
        c1.add(".net");
        System.out.println("c1:"+c1);
        c2.add("android");
        c2.add("ios");
        c2.add("java");
        System.out.println("c2:"+c2);
        c1.addAll(c2);
        System.out.println(c2);
        System.out.println("c1:"+c1);
        System.out.println("c2:"+c2);
        Collection c3=new ArrayList();
        c3.add("java");
        c3.add("ios");
        c3.add("php");
        c3.add("python");
        boolean contains = c1.contains(c3);
        System.out.println("是否包含"+contains);
        /*
        c1.retainAll(c3);
        System.out.println("c1"+c1);
        System.out.println("c3"+c3);

         */
        c1.removeAll(c3);
        System.out.println("c1"+c1);
        System.out.println("c3"+c3);


    }
}
